#include "command.h"
#include <iostream>

Command::Command()
{}

Command::~Command()
{}

ConcreteCommand1::ConcreteCommand1(Receiver* receiver)
{
    this->receiver_ = receiver;
    std::cout << "创建命令1实例" << std::endl;
}

ConcreteCommand1::~ConcreteCommand1()
{
    std::cout << "释放命令1实例" << std::endl;
}

void ConcreteCommand1::Execute()
{
    std::cout << "执行命令1" << std::endl;
    this->receiver_->DoSomething();
}

ConcreteCommand2::ConcreteCommand2(Receiver* receiver)
{
    this->receiver_ = receiver;
    std::cout << "创建命令2实例" << std::endl;
}

ConcreteCommand2::~ConcreteCommand2()
{
    std::cout << "释放命令2实例" << std::endl;
}

void ConcreteCommand2::Execute()
{
    std::cout << "执行命令2" << std::endl;
    this->receiver_->DoSomething();
}
